package com.deyinet.bdcms.dao.impl;


import com.deyinet.bdcms.core.dao.impl.BaseDaoImpl;
import com.deyinet.bdcms.dao.ISysmoduleDao;
import com.deyinet.bdcms.entity.Sysmodule;
import com.deyinet.bdcms.entity.Sysrole;
import com.deyinet.bdcms.entity.Sysuser;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * Created by Bacel on 2017/4/4.
 */
@Repository
public class SysmoduleDao extends BaseDaoImpl<Sysmodule> implements ISysmoduleDao {

    @Override
    public List<Sysmodule> getusermenudata(Sysrole sysrole) {
        String hql="select sm from Sysmodule as sm, Sysroleright as srr " +
                "where srr.sysmoduleByModuleid  = sm.id and srr.sysroleByRoleid=:roleid ";
        Query query   =  getSession().createQuery(hql);
        query.setParameter("roleid",sysrole);
        return query.list();
    }
}
